${pack_own}

import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
${base_pack}.common.enums.resp.GlobalEnum;
${base_pack}.common.exception.BizException;
${base_pack}.common.utils.CopyUtil;
${base_pack}.common.dto.ReqDTO;
${base_pack}.common.dto.ResDTO;
${base_pack}.common.dto.advancedQuery.PageQueryDTO;
${module_pack}.common.constant.AutocodeC;
${module_pack}.common.constant.AutocodeKeyC;
${module_pack}.service.base.BaseManager;
[#-- 方法对象引入 --]
${import_method_class}
[#-- 表对象引入 --]
${import_table_class}
${import_class!''}
${pack_service}

/**
 * ${data_main.moduleKeyName}
 * ${'@author '+author_str!"admin"}
 * @date ${date_str}
 */
@Service
public class ${name_own} extends BaseManager implements ${name_service} {
[#if resource_table_class??]
${resource_table_class}[#-- 载入类dao层 --]
[/#if]
[#if resource_class??]
${resource_class}[#-- 载入类 --]
[/#if]
    
[#if data_method??]
[#list data_method as mdx]
[#if mdx.needFlag == '1']
    /**
     * ${mdx.methodKeyName}
     */
    [#if (mdx.methodOprType!'') == 'getpage' ]
    @Override
    public ${mdx.tags['name_res']} get${mdx.methodKey?cap_first + data_main.moduleKey?cap_first}(${mdx.tags['name_req']} reqInfo,PageQueryDTO page) throws Exception{
        // TODO Auto-generated method stub
        ${mdx.tags['name_res']} resDTO = BeanUtil.copyProperties(page, ${mdx.tags['name_res']}.class);
        
        Map<String,Object> paramMap = BeanUtil.beanToMap(reqInfo);
        
        pageHandle(page);//处理分页数据
        Page<Object> pageHp = PageHelper.startPage(page.getPage(), page.getLimit(),page.getOrder());
        [#if data_table?? && data_table?size>1]
        [#assign eList = mdx.orderEntitys["res"]![] /]
        [#list eList as eVO]
        [#if eVO.useTableCode?? && eVO.useTableCode?trim?length>3]
        [#assign tblx=map_table[eVO.useTableCode]  sqlx=tblx.sqlInterfacesMap[eVO.useTableSqlCode]/]
        List<${tblx.tags['name_entityVo']}> list = ${tblx.tags['lname_dao']}.${sqlx.sqlId}(paramMap);
        [/#if]
        [/#list]
        
        [#elseif data_table?? && data_table?size>0]
        [#assign tblx = data_table[0]  sqlx=tblx.sqlInterfacesMap['selectList']/]
        List<${tblx.tags['name_entityVo']}> list = ${tblx.tags['lname_dao']}.${sqlx.sqlId}(paramMap);
        
        [/#if]
        resDTO.setData(CopyUtil.copyList(list, ${mdx.tags['name_res']}.class));
        resDTO.setCount(pageHp.getTotal());
        
        return resDTO;
    }
    
    [/#if]
[/#if]
[/#list]

[/#if]
